﻿namespace GoodAdmin.System;

/// <summary>
/// 用户管理
/// </summary>
public static class UserManager
{
    /// <summary>
    /// 当前用户Id
    /// </summary>
    public static long UserId => (App.User?.FindFirst(ClaimConst.UserId)?.Value).ToLong();

    /// <summary>
    /// 当前用户帐号
    /// </summary>
    public static string Account => App.User?.FindFirst(ClaimConst.Account)?.Value;

    /// <summary>
    /// 当前用户姓名
    /// </summary>
    public static string Name => App.User?.FindFirst(ClaimConst.Name)?.Value;

    /// <summary>
    /// 是否是超级管理员
    /// </summary>
    public static bool SuperAdmin => (App.User?.FindFirst(ClaimConst.SuperAdmin)?.Value).ToBoolean();

    /// <summary>
    /// 当前用户所属机构id
    /// </summary>
    public static long OrgId => (App.User?.FindFirst(ClaimConst.OrgId)?.Value).ToLong();

}